<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">标题</h1>
		</header>
		<div class="mui-content">
			<button id="btn" type="button" class="mui-btn mui-btn-blue mui-btn-block">按钮</button>
			<p id="imgArray1"></p>
			<p id="imgArray2"></p>
		</div>

		<script src="../../js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
			mui.ajax('http://192.168.0.122:8080/hotel-mgr/query', {
				dataType: 'json', //服务器返回json格式数据
				headers: {
					'Authorization': 'Basic MTUwNjYwNzE2MTc6MTIzNDU2'
				},
				timeout: 8000, //超时时间设置为10秒；
				success: function(data) {
					var images = JSON.stringify(data.envImgThub);
					console.log(images);
					document.getElementById('imgArray1').innerText = images;
				},
				error: function(xhr, type, errorThrown) {
					console.log(xhr.status);
				}
			});
			var deleteImg = new Array();
			deleteImg.push('http://img.chn000.com/hotel/hs2.jpg');
			console.log(deleteImg);
			console.log(JSON.stringify(deleteImg))
			document.getElementById('btn').addEventListener('tap', function() {
				mui.ajax('http://192.168.0.122:8080/hotel-mgr/delete/thub', {
					data: {
						thub:deleteImg
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'post', //HTTP请求类型
					headers: {
						'Authorization': 'Basic MTUwNjYwNzE2MTc6MTIzNDU2'
					},
					timeout: 10000, //超时时间设置为10秒；  
					success: function(data) {
						console.log('成功')
						location.reload();
					},
					error: function(xhr, type, errorThrown) {
						console.log(xhe.status)
					}
				});
			})
		</script>
	</body>

</html>